package com.kly.sc.api.application.controller.user.response;

import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.kly.user.dto.ImagesDto;
import com.kly.user.dto.SelectVal;
import com.kly.user.dto.UserInfoDto;
import com.kly.user.dto.UserTurnOnsDto;
import lombok.Builder;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.Date;
import java.util.List;

@Data
@Builder
public class UserInfoVO {

    private String userCode;
    /**
     * 手机号
     */
    private String mobile;
    /**
     * 用户昵称
     */
    private String nickName;
    /**
     * 性向
     */
    private Integer lookingFor;
    /**
     * 状态：0-初始化，1-运行时、2、关闭
     */
    private Integer status;
    /**
     * 性别 0未知、1男、2女、3武装直升机
     */
    private Integer gender;
    /**
     * 头像地址
     */
    private String avatarUrl;
    /**
     * 邮箱
     */
    private String email;
    /**
     * 用户类型
     */
    private Integer userType;
    /**
     * 生日
     */
//    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM/dd/yyyy")
    private String birthday;

    /**
     * 用户码
     */
    private String aboutMe;

    private String aboutme;


    private List<String> images;

    private List<ImagesDto> imagesV2;

    private List<String> interests;

    private Boolean userValid;

    private Boolean isMember;

    private String memberCode;

    private Integer online;

    private Integer nearby;

    private Integer age;

    private Integer autoRenew;

    private Integer hasGreetingFlag;

    private boolean hideHeight;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM/dd/yyyy")
    private Date expiryDate;

    private Integer privateAlbums;

    private JSONObject memberDescription;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM/dd/yyyy h:mm a")
    private Date localTime;

    public boolean userValid() {
        return this.status == 2;
    }

    public String socialConnections;

    public String socialConnectionsUrl;

    //身高：cm
    private Integer height;
    //身高：英寸
    private String inchHeight;

    private Integer constellation;

    private String constellationName;

    private String constellationIcon;
    //癖好
    private List<UserTurnOnsDto> TurnOnsList;

    /**
     * 账号
     */
    private String cID;

    /**
     * 经度
     */
    private String lng;

    /**
     * 维度
     */
    private String lat;

    /**
     * abount me 状态
     */
    private Integer abountMeStatus;

    /**
     * 州
     */
    private String state;

    /**
     * 城市
     */
    private String city;

    /**
     * I want选项, 单选，必填
     */
    private List<SelectVal> userWant;

    /**
     * You accept选项, 多选，可选
     */
    private List<SelectVal> youAccept;

    /**
     * body shape选项, 多选，可选
     */
    private List<SelectVal> bodyShape;

    /**
     * 促销标签
     */
    private String topTag;

    private String appCode;


    public static UserInfoVO toVo(UserInfoDto dto) {
        if (dto == null) {
            return null;
        }
        UserInfoVO vo = UserInfoVO.builder().build();
        BeanUtils.copyProperties(dto, vo);
        vo.setBirthday(DateUtil.format(dto.getBirthday(), "MM/dd/yyyy"));
        return vo;
    }

}
